package utils

import (
	"strings"
)

// ToCamel 驼峰命名 ibe_log -> IbeLog
func ToCamel(s string) string {

	s = strings.ReplaceAll(s, "_", " ")
	s = strings.ReplaceAll(s, "-", " ")

	// 将字符串按空格分割为单词
	words := strings.Fields(s)

	// 将单词首字母大写并拼接起来
	for i := 0; i < len(words); i++ {
		words[i] = strings.Title(words[i])
	}

	// 将单词拼接成驼峰命名法的形式
	result := strings.Join(words, "")

	return result
}

// ToCamelLower 驼峰命名 ibe_log -> ibeLog
func ToCamelLower(s string) string {
	s = ToCamel(s)
	return strings.ToLower(s[0:1]) + s[1:]
}
